package net.lijingye.education.entity;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * Created by LijingYe on 2016/4/3.
 */
@Entity
@Table(name = "course")
public class Course implements Serializable {
    @Id
    @Column(name = "courseId")
    private String id;
    @Column(name = "courseName")
    private String name;
    @Column(name = "courseCredit")
    private double credit;
    @Column(name = "courseWeekTime")
    private double weekTime;
    @Column(name = "courseStatus")
    private int status;
    @ManyToMany
    @JoinTable(name = "course_source", joinColumns = {@JoinColumn(name = "courseId")}, inverseJoinColumns = {@JoinColumn(name = "sourceId")})
    @OrderBy(value = "time desc")
    private List<Source> sourceList;
    @ManyToMany
    @JoinTable(name = "course_topic", joinColumns = {@JoinColumn(name = "courseId")}, inverseJoinColumns = {@JoinColumn(name = "topicId")})
    @OrderBy(value = "time desc")
    private List<Topic> topicList;

    public Course() {
    }

    public Course(String id, String name, double credit, double weekTime, int status, List<Source> sourceList, List<Topic> topicList) {
        this.id = id;
        this.name = name;
        this.credit = credit;
        this.weekTime = weekTime;
        this.status = status;
        this.sourceList = sourceList;
        this.topicList = topicList;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getCredit() {
        return credit;
    }

    public void setCredit(double credit) {
        this.credit = credit;
    }

    public double getWeekTime() {
        return weekTime;
    }

    public void setWeekTime(double weekTime) {
        this.weekTime = weekTime;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public List<Source> getSourceList() {
        return sourceList;
    }

    public void setSourceList(List<Source> sourceList) {
        this.sourceList = sourceList;
    }

    public List<Topic> getTopicList() {
        return topicList;
    }

    public void setTopicList(List<Topic> topicList) {
        this.topicList = topicList;
    }


}
